/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package GUI;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.Toolkit;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.JTextArea;

/**
 *
 * @author Yaniv Kalif
 */
public class StartPanel extends JPanel
{
    Color _TA_Color;//The Text Areas color
    Color _BG_Color;//The Background color
    public JButton _createGroup;
    public JButton _joinGroup;
    public JTextArea _joinIPText;
    public JTextArea _joinPortText;
    public JTextArea _createPortText;

    Image _imagetitle;

    public StartPanel(ActionListener action_listener)
    {
         this.setLayout(null);
         //Create/Set Colors
            _TA_Color=new Color(152, 251, 152);//create TextArea color
            _BG_Color=new Color(60,179,113);//create BG color
            this.setBackground(_BG_Color);
         //set the title image
             _imagetitle = Toolkit.getDefaultToolkit().getImage("Pics/talk2me.gif");
         //create the Buttons
            _createGroup = new JButton("Create a New Group");
            _createGroup.setBounds(300, 300, 200, 50);
            _createGroup.addActionListener(action_listener);
            this.add(_createGroup);
            
            _joinGroup = new JButton("Join an Existing Group");
            _joinGroup.setBounds(700, 300, 200, 50);
            _joinGroup.addActionListener(action_listener);
            this.add(_joinGroup);

         //create the JTextArea for IP - join
            _joinIPText = new JTextArea("Enter The Group IP");
            _joinIPText.setBounds(700, 350, 200, 20);
            this.add(_joinIPText);
        //create the JTextArea for port - join
            _joinPortText = new JTextArea("Enter The Group PORT");
            _joinPortText.setBounds(700, 370, 200, 20);
            this.add(_joinPortText);
        //create the JTextArea for port - create
            _createPortText = new JTextArea("Enter The PORT you want to listen in");
            _createPortText.setBounds(300, 350, 200, 20);
            this.add(_createPortText);

    }

    @Override
    protected void paintComponent(Graphics g) {
        super.paintComponent(g);
        g.drawImage(_imagetitle, 350, 50, this);
    }


}
